package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProSpPraise;
import com.huizu.project.service.IProSpPraiseService;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 视频点赞列Controller
 * 
 * @author zhangmx
 * @date 2024-06-05
 */
@RestController
@RequestMapping("/project/prosppraise")
public class ProSpPraiseController extends BaseController
{
    @Autowired
    private IProSpPraiseService proSpPraiseService;

    /**
     * 查询视频点赞列列表
     */
    @PreAuthorize("@ss.hasPermi('project:prosppraise:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProSpPraise proSpPraise)
    {
        startPage();
        List<ProSpPraise> list = proSpPraiseService.selectProSpPraiseList(proSpPraise);
        return getDataTable(list);
    }

    /**
     * 导出视频点赞列列表
     */
    @PreAuthorize("@ss.hasPermi('project:prosppraise:export')")
    @Log(title = "视频点赞列", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProSpPraise proSpPraise)
    {
        List<ProSpPraise> list = proSpPraiseService.selectProSpPraiseList(proSpPraise);
        ExcelUtil<ProSpPraise> util = new ExcelUtil<ProSpPraise>(ProSpPraise.class);
        util.exportExcel(response, list, "视频点赞列数据");
    }

    /**
     * 获取视频点赞列详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:prosppraise:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(proSpPraiseService.selectProSpPraiseById(id));
    }

    /**
     * 新增视频点赞列
     */
    @PreAuthorize("@ss.hasPermi('project:prosppraise:add')")
    @Log(title = "视频点赞列", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProSpPraise proSpPraise)
    {
        return toAjax(proSpPraiseService.insertProSpPraise(proSpPraise));
    }

    /**
     * 修改视频点赞列
     */
    @PreAuthorize("@ss.hasPermi('project:prosppraise:edit')")
    @Log(title = "视频点赞列", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProSpPraise proSpPraise)
    {
        return toAjax(proSpPraiseService.updateProSpPraise(proSpPraise));
    }

    /**
     * 删除视频点赞列
     */
    @PreAuthorize("@ss.hasPermi('project:prosppraise:remove')")
    @Log(title = "视频点赞列", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(proSpPraiseService.deleteProSpPraiseByIds(ids));
    }
}
